package com.meiyu.live.tv.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.meiyu.live.R;
import com.meiyu.live.popj.Assort;
import com.meiyu.live.util.DisplayUtils;

/**
 * Created by zbl on 2016/9/12.
 */
public class ColumnTextView extends TextView {

    private Assort bean;

    public ColumnTextView(Context context) {
        super(context);
        init(context);
    }

    public ColumnTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    private void init(Context context) {
        setTextSize(15);
        int paddingleft = DisplayUtils.dpToPixel(context, 5);
        int paddingtop = paddingleft / 2;
        setPadding(paddingleft, paddingtop, paddingleft, paddingtop);
        setTextColor(0xf0ffffff);
        setBackgroundResource(R.drawable.background_column_select);
    }

    public void setData(Assort bean) {
        this.bean = bean;
        update();
    }

    public Assort getData() {
        return bean;
    }

    public void update() {
        if (bean != null) {
            setText(bean.getName());
        }
    }
}
